<!DOCTYPE html >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<link href="{%$URL%}style/webstyleditu.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="{%$URL%}style/nav.css" />
<title>{%$LCMX.touch_name%}-地图</title>
<script src="{%$URL%}js/jquery-1.11.3.js"></script>
<script src="{%$URL%}js/jquery.toTop.min.js"></script>
<script type="text/javascript" src="{%$URL%}js/velocity.min.js"></script>
<script type="text/javascript" src="{%$URL%}js/main.js"></script>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=170493a069b08faaba1a3ac49774fcc9"></script>

<style type="text/css">
html {
	height: 100%;margin:0;padding:0;
}

body {
	height: 100%;
	margin: 0px;
	padding: 0px
}

#allmap {
	height: 100%
}
</style>
</head>

<body style="max-width:640px;margin:0 auto;">
<!--header start-->
{%include file="header.htm"%}
{%lcmx_3g_touch_show set='列表名:touch,编号:1'%}
<div id="allmap"></div>



<script type="text/javascript">

	// 百度地图API功能
var map = new BMap.Map("allmap");
map.centerAndZoom(new BMap.Point('{%$touch.lng%}','{%$touch.lat%}'), 11);
	var geolocation = new BMap.Geolocation();
	geolocation.getCurrentPosition(function(r){
		if(this.getStatus() == BMAP_STATUS_SUCCESS){
			var mk = new BMap.Marker(r.point);
			
			map.panTo(r.point);
			
			var p1 = new BMap.Point(r.point.lng,r.point.lat);  //自动获取所在地坐标
			var p2 = new BMap.Point('{%$touch.lng%}','{%$touch.lat%}'); //正常坐标
			var p3= new BMap.Point('{%$touch.lng%}','{%$touch.pclat%}');  // 偏差坐标
			
			
	var marker = new BMap.Marker(p3);  // 创建标注
	map.addOverlay(marker);              // 将标注添加到地图中

	var opts = {
	  width : 200,     // 信息窗口宽度
	  height: 100,     // 信息窗口高度
	  title : "{%$touch.name%}" , // 信息窗口标题
	  enableMessage:false,//设置允许信息窗发送短息
	  //message:"亲耐滴，晚上一起吃个饭吧？戳下面的链接看下地址喔~"
	}
	var infoWindow = new BMap.InfoWindow("{%$touch.mapdizhi%}", opts);  // 创建信息窗口对象 
	marker.addEventListener("click", function(){          
		map.openInfoWindow(infoWindow,p3); //开启信息窗口
	});
			
			
            var driving = new BMap.DrivingRoute(map, {renderOptions:{map: map, autoViewport: true}});
driving.search(p1, p2);

		}
		    
	},{enableHighAccuracy: true})
	


</script>






<!--footer start-->
{%include file="foot.htm"%}
<!--footer end-->
</body>
</html>



